#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int main() {
    int arr[50];
    int st = 0;
    int cur = 0;
    int del;
    int size;
    scanf("%d", &size);
    for(int i = 0;i<size;++i)
    {   
        scanf("%d", &arr[i]);
    }
    scanf("%d", &del);
    while (cur <= size -1)
    {
        if (arr[cur] == del)
        {
            cur++;
        }
        else {
            arr[st] = arr[cur];
            ++cur;
            ++st;
        }
    }
    for (int i = 0; i < st; ++i)
    {
        printf("%d ", arr[i]);
    }
    return 0;
}